package com.dp.mallchat.transaction.service;

import java.util.Objects;

/**
 * @Author: dupeng
 * @CreateTime: 2024-07-01  17:38
 * @Description: TODO
 */
public class SecureInvokeHolder {

    private static final ThreadLocal<Boolean> SECURE_INVOKE_HOLDER = new ThreadLocal<>();

    public static void setSecureInvokeHolder() {
        SECURE_INVOKE_HOLDER.set(true);
    }

    public static boolean isInvokeHolder() {
        return Objects.nonNull(SECURE_INVOKE_HOLDER.get());
    }

    public static void invokeHolder() {
        SECURE_INVOKE_HOLDER.remove();
    }
}
